#pragma once

#include <iostream>
#include <string>
#include <functional>
#include "log.hpp"

typedef std::function<int(int, int)> func_t;

class Task
{
public:
    Task() {}
    Task(int x, int y, func_t func)
        : _x(x),
          _y(y),
          _startRoutine(func)
    {
    }
    void operator()(const std::string &threadName)
    {
        logMsg(WARNING, "%s 处理任务: %d+%d=%d | %s | %d | %s | %s",
               threadName.c_str(), _x, _y, _startRoutine(_x, _y), __FILE__, __LINE__, __DATE__, __TIME__);
    }

public:
    int _x;
    int _y;
    func_t _startRoutine;
};